package com.dmagic.cms.dao;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.dmagic.cms.common.dao.CommonDao;
import com.dmagic.cms.common.query.PageUtil;
import com.dmagic.cms.common.query.QueryUtil;
import com.dmagic.cms.entity.HeatMap;

@Component
public class HeatMapDao extends CommonDao<HeatMap, Long> {

	public List<HeatMap> getHomePageHeatMap() {
		return findBy("heatMapStatus", true);
	}

	public List<HeatMap> getHeatMapByLinkedHeatMapId(Long linkedHeatMapId) {
		return findBy("linkedHeatMapId", linkedHeatMapId);
	}

	public void searchHeatMaps(PageUtil<Map> pageUtil) throws Exception {
		QueryUtil queryUtil = new QueryUtil();
		queryUtil.setQueryKey("getHeatMap_sql");
		queryUtil.setPageUtil(pageUtil);
		queryUtil.combineQueryString();
		super.find(queryUtil);
	}

	public List<Map> queryHeatMapInfo(Long languageId) {
		return (List<Map>) queryMapDataBySql(getDaoUtil().getQueryString("getHeatMapInfo_sql"), languageId);
	}
}
